<template>
	<view class="flex coupon">
		<view class="coupon-money"><span class="coupon-icon">￥</span>{{discount.amount}}</view>
		<view class="coupon-info">
			<view class="info-tit">{{discount.name}}</view>
			<view class="info-time">{{discount.sTime}}至{{discount.eTime}}</view>
			<view class="info-detail">使用规则<u-icon name="arrow-right"></u-icon>
			</view>
		</view>
		<view class="coupon-btn">
			<view v-if="showUseBtn">
				<u-button shape="circle" size="mini" :custom-style="canUseBtn" v-if="discount.status === 0 && pageType !=true">去使用</u-button>
				<u-button shape="circle" size="mini" :custom-style="canUseBtn" v-if="pageType">领取</u-button>
				<u-button shape="circle" size="mini" :custom-style="notUseBtn" v-if="discount.status !== 0 && pageType != true"
				 disabled>{{discount.status === 1?"已使用":"已失效"}}</u-button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: ["showUseBtn", "discount", "pageType"],
		data() {
			return {
				canUseBtn: {
					background: "linear-gradient(to right,#F74563,#F72A4C)",
					color: "#FFFFFF"
				},
				notUseBtn: {
					background: "#CCCCCC",
					color: "#FFFFFF"
				}
			}
		}
	}
</script>

<style scoped>
	.coupon {
		background: url(../../static/couponbg.png) no-repeat center center/100% 100%;
		margin-bottom: 20rpx;
		padding-right: 24rpx;
	}

	.coupon:last-child {
		margin-bottom: 0;
	}

	.coupon-money {
		width: 184rpx;
		height: 184rpx;
		color: #F00622;
		font-size: 60rpx;
		text-align: center;
		line-height: 184rpx;
	}

	.coupon-icon {
		color: #F73656;
		font-size: 26rpx;
	}

	.coupon-info {
		width: 370rpx;
		padding: 30rpx 20rpx;
		padding-right: 0;
	}

	.info-tit {
		color: #333333;
		font-size: 28rpx;
		line-height: 28rpx;
		margin-bottom: 34rpx;
	}

	.info-time {
		color: #333333;
		font-size: 20rpx;
		line-height: 20rpx;
		margin-bottom: 22rpx;
	}

	.info-detail {
		color: #999999;
		font-size: 20rpx;
		line-height: 20rpx;
	}

	.coupon-btn {
		width: 120rpx;
		padding-top: 74rpx;
	}
</style>
